!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! the subroutine calculate the flow properties after an oblique shock
! according the properties before that shock
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! ref. to chapter 7 of 'gas dynamics' by Zucrow and Hoffman
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! coded by : B. G.
! created  : 2015-07-08
! revised  :
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! nomenclature:
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! warning:
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
subroutine Oshock()
   use VariableDef
   implicit none
   real*8::Vy1,Ux1,Vy2,Ux2
   real*8::temp0,tempV,tempp,temprou,tempT,tempag,tempM,temp1,temp2,temp3,temp4
   
   tempV=V2   ! velocity before the shock
   tempM=sqrt(g*p2/rho2)
   temp0=theta2   ! flow angle before the shock
   temp1=asin(1/tempM)   ! Mach angle before the shock
!   temp2=temp0+abs(temp1-temp0)
   Vy1=tempV*sin(temp1)   ! velocity perpendicular to the shock (before)
   Ux1=tempV*cos(temp1)   ! velocity parallel to the shock (before)
   Vy2=((g+1)*tempM**2*(sin(temp1))**2)/(2+(g-1)*tempM**2*(sin(temp1))**2)   
   Vy2=Vy1/Vy2   ! velocity  perpendicular to the shock (after)
   Ux2=Ux1   ! velocity parallel to the shock (after)
   tempV=sqrt(Vy2**2+Ux2**2)   ! velocity after the shock
   temp3=atan(tan(temp1)*Vy2/Vy1)   ! Mach angle after the shock
   temp4=temp3-temp1+temp0   ! flow angle after the shock
!   Vv2=tempV*sin(temp4)   ! radical velocity after the shock
!   Vu2=tempV*cos(temp4)   ! axial velocity after the shock
   V2=tempV
   theta2=temp4
end subroutine Oshock
